package com.guldan.core.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Silas.
 * Date: 2017/1/8
 * Time: 15:09
 */
public enum ValidatingBankReturnTypeEn {

    infoCanNotNull(1, "第%s条记录，%s必填列不能为空"),
    idCardNotFind(2, "系统中不存在此人"),
    idCardLengthError(3, "身份证长度错误"),
    idCardFormatError(4, "身份证编码规则错误"),
    bankNotFind(5, "银行名称在系统中不存在"),
    formatErrorByRow(6, "第%s条记录，%s，格式错误"),
    notFindRecord(7, "未找到人员记录"),
    bankDateFormatError(8, "第%s条记录，入账日期格式错误，正确格式为：20160101"),

    unknow(-1, "未知");

    private Integer code;
    private String mean;

    ValidatingBankReturnTypeEn(Integer code, String mean) {
        this.code = code;
        this.mean = mean;
    }

    public static ValidatingBankReturnTypeEn toEnum(Integer code) {
        ValidatingBankReturnTypeEn[] values = values();
        for (ValidatingBankReturnTypeEn en : values) {
            if (en.getCode().equals(code)) {
                return en;
            }
        }
        return unknow;
    }

    public Integer getCode() {
        return code;
    }

    public String getMean() {
        return mean;
    }

    public static List<EnumDTO> getList() {
        List<EnumDTO> list = new ArrayList<>();
        for (int k = 0; k < values().length; k++) {
            list.add(new EnumDTO(values()[k].getCode(), values()[k].getMean(), ""));
        }
        return list;
    }

}
